package com.zt.ztyh.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zt.ztyh.dto.LoanDto;
import com.zt.ztyh.dto.LoanUser;
import com.zt.ztyh.entity.User;
import com.zt.ztyh.entity.ZtyhLoanUser;
import com.zt.ztyh.vo.loan.LoanVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.math.BigDecimal;
import java.util.List;

/**
* @author JIASC
* @description 针对表【ztyh_loan_user】的数据库操作Mapper
* @createDate 2024-04-07 14:13:07
* @Entity com.zt.ztyh.domain.ZtyhLoanUser
*/
public interface ZtyhLoanUserMapper extends BaseMapper<ZtyhLoanUser> {

    @Update("update ztyh_loan_user set state=1 where id=#{id}")
    int updateLoan(Long id);

    int addLoan(LoanUser loanUser);

    Page<LoanVo> findUserLoan(@Param("page") Page<LoanVo> page, @Param("loanDto") LoanDto loanDto);

    @Select("select * from ztyh_user where id =#{uid}")
    User findByUserId(Long uid);

    @Select("select loanLines from ztyh_level where level=#{m}")
    BigDecimal findUserByLoanLimit(int m);

    @Select("select * from ztyh_loan_user where id=#{id}")
    LoanUser findLoanUserById(Long id);


    int updateLoanById(LoanUser loanUser);

    @Select("select * from ztyh_user where id=#{uid}")
    User findUserInfo(Long uid);
}




